
<link href="/static/admin/eleme/element.css" rel="stylesheet" />
<link href="/static/admin/eleme/element-extends.css" rel="stylesheet" />

<section id="app" v-cloak>
  <el-row :gutter="20">
    <el-col :span="24">
      <el-input v-model="name" placeholder="请输入联系人姓名" class="mt mb">
        <template slot="prepend">姓名</template>
      </el-input>

      <el-input v-model="username" placeholder="请输入联系人电话（机构帐号）">
        <template slot="prepend">手机</template>
      </el-input>

      <el-input type="textarea" v-model="remarks" placeholder="请输入联系人描述信息" class="mt"></el-input>
    </el-col>
  </el-row>
</section>

<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/layer/layer.js"></script>
<script type="text/javascript" src="/static/admin/js/h.js"></script>
<script type="text/javascript" src="/static/admin/eleme/vue.js"></script>
<script type="text/javascript" src="/static/admin/eleme/element.js"></script>

<script>
var vm = new Vue({
  el: '#app',
  data: {
    {% for k, v in row %}
    {{ k }}: "{{ v }}",
    {% endfor %}
  },
  methods: {
    tips: function(msg){
      this.$message({
        message: msg,
        type: 'warning',
        showClose: true,
      })
    }
  }
})

function call_submit(index){

  if (vm.name == '') {
    vm.tips('请输入联系人姓名');
    return false;
  } else if (!/^1[3-9]\d{9}$/.test(vm.username)) {
    vm.tips('请输入联系人电话（机构帐号）');
    return false;
  }

  let info = {
    id: vm.id,
    name: vm.name,
    username: vm.username,
    remarks: vm.remarks,
    departmentid: vm.departmentid,
  }

  H.ajax('/admin/organization/edituser', info, 'post', function(res){
    parent.layer.msg(res.data, {icon:1, time:2000});
    parent.vm.getList();
    parent.layer.close(index);
  })
}
</script>